Skip to content

feat(notifications): mark-read flows (PR 2/7)#513

Merged
sarthak688 merged 1 commit into
mainfrom
feat/notifications-mark-read
Jul 2, 2026
Merged

feat(notifications): mark-read flows (PR 2/7)#513
sarthak688 merged 1 commit into
mainfrom
feat/notifications-mark-read

Conversation

@sarthak688

@sarthak688 sarthak688 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

PR 2/7 in the Notification SDK stack. Stacked on top of #512.

Adds the three mark-read methods on the Notifications service. All hit the same UpdateRead OData action endpoint; markAllRead uses the server-side forceAllRead flag.

Methods Added

Layer Method Signature
Service notifications.markAsRead() markRead(tenantId: string, notificationIds: string[]): Promise<NotificationUpdateReadResponse>
Service notifications.markAsUnread() markUnread(tenantId: string, notificationIds: string[]): Promise<NotificationUpdateReadResponse>
Service notifications.markAllAsRead() markAllRead(tenantId: string): Promise<NotificationMarkAllReadResponse>

Endpoint Called

Method HTTP Endpoint OAuth Scope
markAsRead() / markAsUnread() / markAllAsRead() POST notificationservice_/notificationserviceapi/odata/v1/NotificationEntry/UiPath.NotificationService.Api.UpdateRead NotificationService
  • markAsRead and markAsUnread delegate to a private updateRead(tenantId, ids, read) helper to share the POST body construction.
  • markAllAsRead sends { notifications: [], forceAllRead: true } — the server reads all notifications for the acting user regardless of the empty array.
  • All three carry @track(...) telemetry decorators.

Example Usage

import { Notifications } from '@uipath/uipath-typescript/notifications';

const notifications = new Notifications(sdk);
const tenantId = '<tenant-guid>';

await notifications.markAsRead(tenantId, ['<notificationId-1>', '<notificationId-2>']);
await notifications.markAsUnread(tenantId, ['<notificationId>']);
await notifications.markAllAsRead(tenantId);

API Response vs SDK Response

These methods don't return entity data — they wrap the API's empty 200 in an OperationResponse<T> for consistency with other SDK mutation methods:

Method SDK Response
markAsRead / markAsUnread { success: true, data: { notificationIds, read } }
markAllAsRead { success: true, data: { all: true, read: true } }

Sample SDK Response

notifications.markAsRead(tenantId, [''])
{
  "success": true,
  "data": {
    "notificationIds": ["9a3b0db5-9b8b-44a7-9b6a-08de0a17b4e2"],
    "read": true
  }
}

Verification

Check Status
npm run typecheck ✅ clean
npm run lint ✅ 0 warnings, 0 errors
npm run test:unit ✅ 10 tests in notification suite (up from 4)

Files

Area Files
Endpoint constants src/utils/constants/endpoints/notification.ts (UPDATE_READ)
Models src/models/notification/notifications.models.ts (response types + ServiceModel methods)
Service src/services/notification/notifications.ts (methods + private updateRead helper)
Unit tests tests/unit/services/notification/notifications.test.ts (+6 tests)
Integration tests tests/integration/shared/notification/notifications.integration.test.ts (+2 tests)
Docs docs/oauth-scopes.md

PR Stack

# Branch Status
1 feat/notifications-sdk #512
2 feat/notifications-mark-read (this PR)
3 feat/notifications-delete upcoming
4 feat/subscriptions-sdk upcoming
5 feat/subscriptions-topic-updates upcoming
6 feat/subscriptions-publisher-updates upcoming
7 feat/subscriptions-mode-reset upcoming

🤖 Generated with Claude Code

sarthak688 added a commit that referenced this pull request Jun 12, 2026
…markAllRead tests

Matches the pattern in the parallel markRead test and the convention
in agent_docs/rules.md ("Use domain-specific error constants for
entity-specific method tests").

Addresses review comments on PR #513.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread tests/unit/services/notification/notifications.test.ts Outdated
@sarthak688

Copy link
Copy Markdown
Contributor Author

All findings addressed in the latest commit on this branch. Inline reply threads are resolved with commit references.

sarthak688 added a commit that referenced this pull request Jun 12, 2026
…s entries

Same treatment as PR #512 / #513 — tag deleteNotifications, deleteAll
@internal in models + service, drop their oauth-scopes entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sarthak688 sarthak688 force-pushed the feat/notifications-sdk branch 10 times, most recently from 35d8ef4 to 32c58a9 Compare June 16, 2026 10:40
@sarthak688 sarthak688 force-pushed the feat/notifications-sdk branch 3 times, most recently from 9d136e9 to 0f2e425 Compare June 29, 2026 12:14
@sarthak688 sarthak688 force-pushed the feat/notifications-sdk branch 4 times, most recently from 8a4a2a0 to 5b4d11c Compare June 30, 2026 10:49
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Stale class-level JSDoc — still unfixed

src/services/notification/notifications.ts, lines 40–41 (outside the diff):

Further inbox operations (mark-read,
delete) land in follow-up PRs.

This PR ships markRead, markUnread, and markAllRead, so the sentence now refers to completed work. It should be updated to:

Further inbox operations (delete) land in follow-up PRs.

This was flagged in a prior review but the code hasn't changed — the author's claim that all findings were addressed does not appear to have included this line.

@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sarthak688 sarthak688 force-pushed the feat/notifications-mark-read branch 2 times, most recently from aaaef48 to 5bdbf0a Compare July 1, 2026 13:32
@UiPath UiPath deleted a comment from claude Bot Jul 1, 2026
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Comment on lines +40 to 41
* `/odata/v1/NotificationEntry` API).
*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class description was correctly trimmed to remove the stale "mark-read … land in follow-up PRs" sentence, but the first line is still incomplete now that this PR ships the mark-read methods.

Suggested change
* `/odata/v1/NotificationEntry` API).
*
* Provides inbox operations against the current user's notifications (the
* `/odata/v1/NotificationEntry` API).

Using the broader "inbox operations" keeps the description accurate through future PRs (delete, etc.) without needing another touch-up.

Comment thread tests/integration/shared/notification/notifications.integration.test.ts Outdated
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review summary — 2 findings posted

  1. Stale class description (notifications.ts:40-41) — 'Provides list operations' is now incomplete; suggested 'Provides inbox operations'.
  2. markAllRead leaves inbox all-read (notifications.integration.test.ts:146-150) — would break the markRead test on subsequent runs; suggested snapshot-operate-restore pattern matching the markRead test.

@Sarath1018

Copy link
Copy Markdown
Collaborator

rebase with main to pass the PR Checks / test-and-build gate.
In the following 4 PRs convert () => function () { return … } in mockApiClient

#518 | feat(subscriptions): publisher/group updates (6/7)
#517 | feat(subscriptions): topic-level updates (5/7)
#516 | feat(subscriptions): foundation + read (4/7)
#514 | feat(notifications): delete flows (3/7)

Comment thread src/utils/constants/endpoints/notification.ts
@Sarath1018

Copy link
Copy Markdown
Collaborator

@sarthak688 I hope you are running these integration tests locally and making sure these are passing with bearer token

Comment thread src/models/notification/notifications.models.ts Outdated
Comment thread src/models/notification/notifications.models.ts
@sarthak688

Copy link
Copy Markdown
Contributor Author

FYI @Sarath1018
image

@sarthak688 sarthak688 force-pushed the feat/notifications-mark-read branch from 5bdbf0a to 323f6b1 Compare July 1, 2026 15:09
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sarthak688 sarthak688 force-pushed the feat/notifications-mark-read branch from 323f6b1 to 95b10b2 Compare July 1, 2026 15:19
@claude

claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review summary — 1 thread unresolved

Unresolved: stale class description (src/services/notification/notifications.ts, line ~40)

The prior review requested changing "Provides list operations""Provides inbox operations" now that the mark-read methods ship in this PR. The thread was closed without applying that change — the line still reads Provides list operations against the current user's notifications. Reopened the thread so it can be addressed before merge.

…llRead) [internal]

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sarthak688 sarthak688 force-pushed the feat/notifications-mark-read branch from 95b10b2 to a0128d8 Compare July 2, 2026 05:05
@sarthak688 sarthak688 requested a review from vnaren23 July 2, 2026 05:05
@claude

claude Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@vnaren23 vnaren23 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Have claude update the PR description to match AsRead changes.

@sarthak688 sarthak688 merged commit ff519fd into main Jul 2, 2026
18 checks passed
@sarthak688 sarthak688 deleted the feat/notifications-mark-read branch July 2, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants